﻿@using VideoSeller.Business.Data
@model IEnumerable<Setting>

@{
	ViewBag.Title = "Settings";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<h2>Settings</h2>
<table>
	<tr>
		<th>ID</th>
		<th>Key</th>
		<th>Value</th>
		<th>Description</th>
		<th>Actions</th>
	</tr>
	@foreach (var item in Model) {
		<tr>
			<td>@item.Id</td>
			<td>@item.KeyName</td>
			<td>@item.Value</td>
			<td>@item.Description</td>
			<td>
				<input type="button" value="Edit" onclick="@string.Format("openUpdateSettingWindow('{0}', '{1}', '{2}', '{3}');", item.Id, item.KeyName, item.Value, item.Description)"/>
			</td>
		</tr>
	}
</table>
<div id="edit-setting" title="Edit setting">
	<form id="editSettingForm" method="post" action="@Url.Action("UpdateSetting", "Admin")">
		<input id="Id" name="Id" type="hidden"/>
		<h3 id="settingKey"></h3>
		Value<br/><input id="Value" name="Value" type="text"/><br/><br/>
		Description<br/><textarea id="Description" name="Description"></textarea>
	</form>
</div>